package com.ccp.dev.system.model;


import com.ccp.dev.core.basic.model.BaseModel;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

/**
 * 对象功能:发送消息 Model对象
 * 开发人员:csx
 * 创建时间:2012-01-14 15:10:58
 */
public class MessageSend extends BaseModel
{
	/**	个人信息 */
	public final static String MESSAGETYPE_PERSON="1";
	/**	日程安排  */
	public final static String MESSAGETYPE_SCHEDULE="2";
	/**	计划任务 */
	public final static String MESSAGETYPE_PLAN="3";
	/**	系统信息 */
	public final static String MESSAGETYPE_SYSTEM="4";
	/**	代办提醒 */
	public final static String MESSAGETYPE_AGENCY ="5";
	/**	流程提醒 */
	public final static String MESSAGETYPE_FLOWTASK ="6";
	/**	可编辑 */
	public final static Short CANEDIT =1;
	/**	不可编辑 */
	public final static short NOTEDIT =0;

	public final static String SPLIT_FLAG = "[userorg]";
	public final static String ISFILTEL ="0";

	/** 主键 */
	protected String id;
	/** 标题 */
	protected String subject;
	/** 发送人ID */
	protected String userId;
	/** 发送人 */
	protected String userName;
	/** 消息类型(使用数据字典） */
	protected String messageType;
	/** 内容 */
	protected String content;
	/** 发送时间 */
	protected java.util.Date sendTime;
	/** 不需回复 */
	protected Short canReply;
	/** 接受人姓名 */
	protected String receiverName;
	/** 接收组织名 */
	protected String receiverOrgName;
	/**	收信时间 */
	protected java.util.Date receiveTime;
	/**	收信id */
	protected String rid;
	/**	附件 */
	protected String attachment;
	/**	密级 */
	protected int privacyLevel;
	/** 是否删除 ，==0 有效 ；==1 已删除 */
	protected int isDelete;
	/*新增属性用于数据传输处理无数据库对于实体*/
	/**	接收组织id */
	protected  String receiverOrgId;
	/**	接收人id */
	protected  String  receiverId;
    /**	是否修改 */
	protected   int  edit;
	/** 消息来源 */
	private int receiveType;

	//附件
	private String jsonFile;

	public int getEdit() {
		return edit;
	}

	public void setEdit(int edit) {
		this.edit = edit;
	}

	public String getReceiverOrgId() {
		return receiverOrgId;
	}

	public void setReceiverOrgId(String receiverOrgId) {
		this.receiverOrgId = receiverOrgId;
	}

	public String getReceiverId() {
		return receiverId;
	}

	public void setReceiverId(String receiverId) {
		this.receiverId = receiverId;
	}

	public String getRid()
	{
		return rid;
	}
	public void setRid(String rid)
	{
		this.rid = rid;
	}
	public java.util.Date getReceiveTime()
	{
		return receiveTime;
	}
	public void setReceiveTime(java.util.Date receiveTime)
	{
		this.receiveTime = receiveTime;
	}
	public void setId(String id)
	{
		this.id = id;
	}
	public int getIsDelete() {
		return isDelete;
	}
	public void setIsDelete(int isDelete) {
		this.isDelete = isDelete;
	}

	/**
	 * 返回 主键
	 * @return
	 */
	public String getId()
	{
		return id;
	}

	public void setSubject(String subject) 
	{
		this.subject = subject;
	}
	/**
	 * 返回 标题
	 * @return
	 */
	public String getSubject() 
	{
		return subject;
	}

	public void setUserId(String userId)
	{
		this.userId = userId;
	}
	/**
	 * 返回 发送人ID
	 * @return
	 */
	public String getUserId()
	{
		return userId;
	}

	public void setUserName(String userName) 
	{
		this.userName = userName;
	}
	/**
	 * 返回 发送人
	 * @return
	 */
	public String getUserName() 
	{
		return userName;
	}

	public void setMessageType(String messageType) 
	{
		this.messageType = messageType;
	}
	/**
	 * 返回 消息类型(使用数据字典）
	 * @return
	 */
	public String getMessageType() 
	{
		return messageType;
	}

	public void setContent(String content) 
	{
		this.content = content;
	}
	/**
	 * 返回 内容
	 * @return
	 */
	public String getContent() 
	{
		return content;
	}

	public void setSendTime(java.util.Date sendTime) 
	{
		this.sendTime = sendTime;
	}
	/**
	 * 返回 发送时间
	 * @return
	 */
	public java.util.Date getSendTime() 
	{
		return sendTime;
	}

	public void setCanReply(Short canReply) 
	{
		this.canReply = canReply;
	}
	/**
	 * 返回 不需回复
	 * @return
	 */
	public Short getCanReply() 
	{
		return canReply;
	}

	public void setReceiverName(String receiverName) 
	{
		this.receiverName = receiverName;
	}
	/**
	 * 返回 receiverName
	 * @return
	 */
	public String getReceiverName() 
	{
//		if(receiverName.indexOf(SPLIT_FLAG)!=-1){
//			receiverName = receiverName.replace(SPLIT_FLAG, ",");
//		}
		return receiverName;
	}
	
	public String getReceiverOrgName() {
//		if(receiverName.indexOf(SPLIT_FLAG)!=-1){
//			receiverOrgName = receiverOrgName.split("[org]")[1];
//		}
		return receiverOrgName;
	}
	public void setReceiverOrgName(String receiverOrgName) {
		this.receiverOrgName = receiverOrgName;
	}
   
	
   	public String getAttachment() {
		return attachment;
	}
	public void setAttachment(String attachment) {
		this.attachment = attachment;
	}
	
	
	public int getPrivacyLevel() {
		return privacyLevel;
	}
	public void setPrivacyLevel(int privacyLevel) {
		this.privacyLevel = privacyLevel;
	}

	public int getReceiveType() {
		return receiveType;
	}

	public void setReceiveType(int receiveType) {
		this.receiveType = receiveType;
	}

	public String getJsonFile() {
		return jsonFile;
	}

	public void setJsonFile(String jsonFile) {
		this.jsonFile = jsonFile;
	}

	/**
	 * @see Object#equals(Object)
	 */
	@Override
	public boolean equals(Object object)
	{
		if (!(object instanceof MessageSend))
		{
			return false;
		}
		MessageSend rhs = (MessageSend) object;
		return new EqualsBuilder()
		.append(this.id, rhs.id)
		.append(this.subject, rhs.subject)
		.append(this.userId, rhs.userId)
		.append(this.userName, rhs.userName)
		.append(this.messageType, rhs.messageType)
		.append(this.content, rhs.content)
		.append(this.sendTime, rhs.sendTime)
		.append(this.canReply, rhs.canReply)
		.append(this.receiverName, rhs.receiverName)
		.append(this.attachment, rhs.attachment)
		.append(this.receiverId,rhs.receiverId)
		.append(this.receiverOrgId,this.receiverOrgId)
		.append(this.receiverOrgName,this.receiverOrgName)
		.append(this.receiveType,this.receiveType)
		.append(this.jsonFile,this.jsonFile)
		.isEquals();
	}

	/**
	 * @see Object#hashCode()
	 */
	@Override
	public int hashCode()
	{
		return new HashCodeBuilder(-82280557, -700257973)
		.append(this.id)
		.append(this.subject)
		.append(this.userId)
		.append(this.userName)
		.append(this.messageType)
		.append(this.content)
		.append(this.sendTime)
		.append(this.canReply)
		.append(this.receiverName)
		.append(this.attachment)
		.append(this.receiverId)
		.append(this.receiverOrgId)
		.append(this.receiverOrgName)
		.append(this.receiveType)
		.append(this.jsonFile)
		.toHashCode();
	}

	/**
	 * @see Object#toString()
	 */
	@Override
	public String toString() 
	{
		return new ToStringBuilder(this)
		.append("id", this.id) 
		.append("subject", this.subject) 
		.append("userId", this.userId) 
		.append("userName", this.userName) 
		.append("messageType", this.messageType) 
		.append("content", this.content) 
		.append("sendTime", this.sendTime) 
		.append("canReply", this.canReply) 
		.append("attachment", this.attachment)
		.append("receiverId",this.receiverId)
		.append("receiverName", this.receiverName)
		.append("receiverOrgId",this.receiverOrgId)
		.append("receiverOrgName",this.receiverOrgName)
		.append("receiveType",this.receiveType)
		.append("jsonFile",this.jsonFile)
		.toString();
	}
  
}